﻿using PressureTest.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PressureTest
{
    public partial class SetParamter : Form
    {
        MainForm f;
        List<TestAddress> testaddress;
        public SetParamter(MainForm _f,List<TestAddress> _testaddress)
        {
            f = _f;
            testaddress = _testaddress;
            InitializeComponent();
            
        }

        private void cmbtype_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbtype.Text=="UrlParamter")
            {
                txtkey.Width = 60;
                labreq.Visible = true;
                labindex.Visible = true;
                txtindex.Visible = true;
                txtcindex.Visible = true;
                txtreq.Visible = true;
            }
            else
            {
                txtkey.Width = 250;
                labreq.Visible = false;
                labindex.Visible = false;
                txtindex.Visible = false;
                txtcindex.Visible = false;
                txtreq.Visible = false;
            }
        }

        private void btnok_Click(object sender, EventArgs e)
        {
            this.Hide();
            f.spisHide = true;
            //this.Close();
        }

        private void btnadd_Click(object sender, EventArgs e)
        {
            testaddress.Add(new TestAddress(txttesturl.Text, cmbtestmethod.Text, txterrorcode.Text));
            dgv.DataSource = testaddress.ToArray();
        }

        private void dgv_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
        {
            
        }

        private void SetParamter_FormClosing(object sender, FormClosingEventArgs e)
        {
            
        }
    }
}
